package org.seckill.dto;

import org.seckill.entity.SuccessKilled;
import org.seckill.enums.SeckillstateEnum;

/**
 * Created by lenovo on 2017/7/5.
 */
public class SeckillExcution {

    //秒杀商品id
    private Long seckillId;
    //秒杀执行结果状态
    private int state;
    //状态表示
    private String stateInfo;
    //秒杀成功对象
    private SuccessKilled successKilled;
    //秒杀成功的构造器
    public SeckillExcution(Long seckillId, SeckillstateEnum seckillstateEnum, SuccessKilled successKilled) {
        this.seckillId = seckillId;
        this.state =seckillstateEnum.getState();
        this.stateInfo = seckillstateEnum.getStateInfo();
        this.successKilled = successKilled;
    }
    //秒杀失败的构造器
    public SeckillExcution(Long seckillId,SeckillstateEnum seckillstateEnum) {
        this.seckillId = seckillId;
        this.state = seckillstateEnum.getState();
        this.stateInfo =seckillstateEnum.getStateInfo();
    }

    @Override
    public String toString() {
        return "SeckillExcution{" +
                "seckillId=" + seckillId +
                ", state=" + state +
                ", stateInfo='" + stateInfo + '\'' +
                ", successKilled=" + successKilled +
                '}';
    }

    public Long getSeckillId() {
        return seckillId;
    }

    public void setSeckillId(Long seckillId) {
        this.seckillId = seckillId;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }

    public SuccessKilled getSuccessKilled() {
        return successKilled;
    }

    public void setSuccessKilled(SuccessKilled successKilled) {
        this.successKilled = successKilled;
    }
}
